﻿<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends CI_Controller {
	public function __construct(){
		parent::__construct();
		$this->load->model('all_model');
	}
	public function index(){
		$blogsList = $this->all_model->listAllBlogs();
		$employeesList = $this->all_model->listAllEmployees();
		$data = array(
			'employee' => 'employee',
			'blogs'=> 'blogs',
			'blogsUpload'=> 'blogsUpload',
			'blogsList'=>$blogsList,
			'employeesList'=>$employeesList
		);
		$this->load->view('home',$data);
	}
	public function newData(){
		$data = array(
			'title'=>$this->input->post('title'),
			'blog'=>$this->input->post('blog'),
		);
		$status = $this->all_model->createNewBlog($data);
		if($status){
			redirect('home','refresh');
		}else{
			$this->load->view('no');
		}
	}
}

/* End of file home.php */
/* Location: ./application/controllers/home.php */